package com.itheima.chapter06.lambda.test1;

public class Test{
    public static void main(String[] args) {
        goSwimming(new Swimming() {
            @Override
            public void swim() {
                System.out.println("铁汁，我们游泳去！");
            }
        });

        //Lambda表达式，对匿名内部类进行优化

        goSwimming(() -> {
            System.out.println("铁汁，我们游泳去！***");
        });
        goSwimming(() -> System.out.println("铁汁，我们游泳去！***"));
    }
    public static void goSwimming(Swimming swimming){
        Swimming swimming1=new Swimming() {
            @Override
            public void swim() {
                System.out.println("铁汁，我们游泳去！---");
            }
        };
        swimming.swim();//匿名内部类
        swimming1.swim();
    }
}

interface Swimming{
    void swim();
}